<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link href="../../plugins/mui/mui.min.css" rel="stylesheet"/>
		<link href="../../css/index/main.css" rel="stylesheet"/>
		<link href="../../css/style.css" rel="stylesheet"/>
		<script src="../../js/statistics.js"></script>
	</head>
	<body>
		<div class="head">
    		<div class="foot-page">
    			<span>河东区</span>
    			<span id='weather11'></span>
    		</div>
		</div>
		<div class="bar-nav first">
			<ul class="clear">
				<li>
					<img src="../../images/icon/administrator.png">
					<p class="color-4d">行政办事</p>
					<a href="../../pages/executive_housekeeper/law_guide.html"></a>
				</li>
				<li>
					<img src="../../images/icon/directory.png">
					<p class="color-4d">企业黄页</p>
					<a href="../../pages/directory/index.html"></a>
				</li>
				<li>
					<img src="../../images/icon/travel.png">
					<p class="color-4d">精彩河东</p>
					<a href="../../pages/city/vr_index.html"></a>
				</li>
				<li>
					<img src="../../images/icon/city.png">
					<p class="color-4d">河东论坛</p>
					<a href="../../pages/city/tribune_index.html"></a>
				</li>
			</ul>
		</div>
		<div class="bar-nav second">
			<ul class="clear">
				<li>
					<div>
						<p>自在生活</p>
						<span>便民生活服务</span>
						<img src="../../images/icon/life.png">
						<a href="../life_housekeeper/index.html"></a>
					</div>
				</li>
				<li>
					<div>
						<p>自在民生</p>
						<span>公共行政查询</span>
						<img src="../../images/icon/administration.png">
						<a href="../executive_housekeeper/index.html"></a>
					</div>
				</li>
				<li>
					<div>
						<p>自在出行</p>
						<span>交通出行服务</span>
						<img src="../../images/icon/car.png">
						<a href="../trave_housekeeper/index.html"></a>
					</div>
				</li>
			</ul>
		</div>
		<div class="new-box">
			<div class="title">
				<span>新闻动态</span>
				<span></span>
				<a href="../news_list/index.html"></a>
			</div>
			<div class="news_body">
			</div>
		</div>
		<script src="../../plugins/template/template.js"></script>
		<script src="../../plugins/jquery/jquery-3.1.0.min.js"></script>
		<script src="../../plugins/mui/mui.min.js"></script>
		<script src="../../js/getApiToken.js"></script>
		<script src="../../js/fontset.js"></script>
		<script src="../../js/md5.js"></script>
		<script id="banner" type="text/html">
			<div class="mui-slider" id="slider">
				<div class="mui-slider-group mui-slider-loop">
				    <!--支持循环，需要重复图片节点-->
				    <div class="mui-slider-item mui-slider-item-duplicate">
				    	<a href="#">
				    		<img src="{{baseUrl}}{{data[data.length-1].path}}"/>
				    	</a>
				    </div>
		    		{{each data as value i}}
			    		<div class="mui-slider-item" onclick="bannerLeft('{{value.url}}')">
			    			<a href="#">
			    				<img src="{{baseUrl}}{{value.path}}" />
			    			</a>
			    		</div>
		    		{{/each}}
		    		<div class="mui-slider-item mui-slider-item-duplicate">
		    			<a href="#">
		    				<img src="{{baseUrl}}{{data[0].path}}" />
		    			</a>
		    		</div>
		    	</div>
		    	<div class="mui-slider-indicator mui-text-right">
					<div class="mui-indicator mui-active"></div>
					<div class="mui-indicator"></div>
					<div class="mui-indicator"></div>
					<div class="mui-indicator"></div>
				</div>
    		</div>
    	</script>
    	<script id="new-list" type="text/html">
    		<ul>
    			{{each data as value i}}
					<li class="clear" onclick="goNewList({{value.id}},'{{baseUrl}}{{value.path}}')">
						<div>
							<img src="{{baseUrl}}{{value.path}}"></img>
						</div>
						<div>
							<h4>{{value.title}}</h2>
							<span>{{value.views}}</span>
							<span>{{value.date}}</span>
						</div>
					</li>
				{{/each}}
			</ul>
    	</script>
    	<script>
    		mui.init({
    			keyEventBind: {
					backbutton: false,  
					menubutton: true   
				}
    		});
    		mui.plusReady(function(){
    			
    			$(".title").on('tap',function(e){
    				mui.openWindow({
    					url:'../news_list/index.html',
    					id:'news_list/index',
    					show:{
      						autoShow:true,
      						aniShow:'fade-in'
      					}
    				});
    				e.preventDefault();
    			})
    			
    			$(".bar-nav").on('click','li',function(item){
    				var href = $(this).find("a").attr("href");
    				console.log(888)
    				mui.openWindow({
    					url:href,
    					id:href,
    					waiting:{
				      		autoShow:true,//自动显示等待框，默认为true
				      		title:'正在加载...',//等待对话框上显示的提示内容
      					},
      					show:{
      						autoShow:true,
      						aniShow:'fade-in'
      					},
      					extras:{
      						type:'all'
      					}
      				
    				})
    				console.log(href)
    			});
    			
    			myAjax('news/news/getThreeTopNews','post',{},function(data){
    				if(data.success){
    					var list = {
    						data:data.data,
    						baseUrl:_baseUrl
    					};
    					var html = template('new-list',list);
    					$(".news_body").append(html);
    				}
    			});
    			
    			myAjax('base/banner/getbanner','get',{},function(data){
    				if(data.success){
    					console.log(JSON.stringify(data))
    					var list = {
    						data:data.data,
    						baseUrl:_baseUrl
    					};
    					var html = template('banner',list);
    					$(".head").append(html);
    					var gallery = mui('.mui-slider');
						gallery.slider({
						  interval:5000//自动轮播周期，若为0则不自动播放，默认为0；
						});
    				}
    			});
    			
    			
    			mui.ajax('http://api.map.baidu.com/telematics/v3/weather?location=临沂河东区&output=json&ak=bKkCa6mmMCFdzXD4p5bjyiNX',{
					dataType : 'jsonp',
					type:'get',//HTTP请求类型
					timeout:10000,//超时时间设置为10秒；
					headers:{'Content-Type':'application/json'},	              
					success:function(data){
							var data=JSON.parse(data);
						 $('#weather11').html(data.results[0].weather_data[0].temperature);
					},
					error:function(xhr,type,errorThrown){
						//异常处理；
						console.log(type);
					}
				});
    			
    			
    			
    		});
    		function goNewList(id,img){
    			mui.openWindow({
    				url:'../news_list/detail.html',
    				id:'detail.html',
    				extras:{
    					detail_id:id,
    					shareimg:img
    				},
    				waiting:{
			      		autoShow:true,//自动显示等待框，默认为true
			      		title:'正在加载...',//等待对话框上显示的提示内容
					},
					show:{
						autoShow:true,
						aniShow:'fade-in'
					}
    			});
    		}
    		
    		//页面跳转
    		function bannerLeft(url){
    			console.log(url)
    			if(url.indexOf('http')== -1 && url.indexOf('https') == -1){
    				if(url.indexOf('news_list') == -1 && url.indexOf('id') == -1){
    					mui.openWindow({
		    				url:url,
		    				id:url,
		    				waiting:{
					      		autoShow:true,//自动显示等待框，默认为true
					      		title:'正在加载...',//等待对话框上显示的提示内容
	      					},
	      					show:{
	      						autoShow:true,
	      						aniShow:'fade-in'
	      					}
		    			});
    				}else{
    					var sbr = url.search('id');
    					id = url.substring(sbr+3,url.length);
    					console.log(id)
    					mui.openWindow({
    						url:'../news_list/detail.html',
    						id:'detail.html',
    						extras:{
    							detail_id:id,
    							shareimg:'_www/logo.png'
    						},
    						waiting:{
					      		autoShow:true,//自动显示等待框，默认为true
					      		title:'正在加载...',//等待对话框上显示的提示内容
							},
							show:{
								autoShow:true,
								aniShow:'fade-in'
							}
    					})
    				}
    			}else{
    				mui.openWindow({
    					url:'../life_housekeeper/detail.html',
    					extras:{
    						'link':url
    					},
    					waiting:{
				      		autoShow:true,//自动显示等待框，默认为true
				      		title:'正在加载...',//等待对话框上显示的提示内容
      					},
      					show:{
      						autoShow:true,
      						aniShow:'fade-in'
      					}
    				})
    			}
    			
    		}
    	</script>
	</body>
</html>
